<?php
 if (!session_id()) {
      session_start();
    }
    

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class secure
{
    function secureSuperGlobalGET(&$value, $key)
    {
        $_GET[$key] = htmlspecialchars(stripslashes($_GET[$key]));
        $_GET[$key] = str_ireplace("script", "blocked", $_GET[$key]);
        $_GET[$key] = mysql_escape_string($_GET[$key]);
        return $_GET[$key];
    }
   
    function secureSuperGlobalPOST(&$value, $key)
    {
        $_POST[$key] = htmlspecialchars(stripslashes($_POST[$key]));
        $_POST[$key] = str_ireplace("script", "blocked", $_POST[$key]);
        $_POST[$key] = mysql_escape_string($_POST[$key]);
        return $_POST[$key];
    }
       
    function secureGlobals()
    {
        array_walk($_GET, array($this, 'secureSuperGlobalGET'));
        array_walk($_POST, array($this, 'secureSuperGlobalPOST'));
    }
}

global $wpdb;
$tb = 'ap_painting_user' ; 

$secure = new secure(); 
$secure->secureGlobals(); 
$data = array('name'=> $_POST['xusername'],'birthday' => "{$_POST['xday']}-{$_POST['xmonth']}-{$_POST['xyear']}",'user_id' => $_SESSION['user_id'] );
$wpdb->insert($tb,$data);

die; 

